package server

import (
	"cgs-server/server/model"
	"time"
)

var CstZone = time.FixedZone("CST", 8*3600)

const (
	// CategoryCollectionName is the collection name that we store categories in mongo.
	CategoryCollectionName string = "_Category"
	// SceneCollectionName is the collection name that we store scenes in mongo.
	SceneCollectionName string = "_Scene"
	// MeshCollectionName is the collection name that we store meshes in mongo.
	MeshCollectionName string = "_Mesh"
	// MapCollectionName is the collection name that we store textures in mongo.
	MapCollectionName string = "_Map"
	// MaterialCollectionName is the collection name that we store materials in mongo.
	MaterialCollectionName string = "_Material"
	// AudioCollectionName is the collection name that we store audios in mongo.
	AudioCollectionName string = "_Audio"
	// AnimationCollectionName is the collection name that we store animations in mongo.
	AnimationCollectionName string = "_Animation"
	// ParticleCollectionName is the collection name that we store particles in mongo.
	ParticleCollectionName string = "_Particle"
	// PrefabCollectionName is the collection name that we store prefabs in mongo.
	PrefabCollectionName string = "_Prefab"
	// CharacterCollectionName is the collection name that we store characters in mongo.
	CharacterCollectionName string = "_Character"
	// ScreenshotCollectionName is the collection name that we store screenshots in mongo.
	ScreenshotCollectionName string = "_Screenshot"
	// VideoCollectionName is the collection name that we store videos in mongo.
	VideoCollectionName string = "_Video"
	// FileCollectionName is the collection name that we store files in mongo.
	FileCollectionName string = "_File"
	// ConfigCollectionName is the collection name that we store system configs in mongo.
	ConfigCollectionName string = "_Config"
	// RoleCollectionName is the collection name that we store roles in mongo.
	RoleCollectionName string = "_Role"
	// UserCollectionName is the collection name that we store users in mongo.
	UserCollectionName string = "_User"
	// UserRole
	UserRole string = "_UserRole"
	// Authority
	AuthorityCollectionName string = "_Authority"
	// OperatingAuthorityCollectionName is the collection name that we store roles' authorities in mongo.
	OperatingAuthorityCollectionName string = "_OperatingAuthority"
	// RoleAuthority
	RoleAuthorityCollectionName string = "_RoleAuthority"
	// DepartmentCollectionName is the collection name that we store departments in mongo.
	DepartmentCollectionName string = "_Department"
	// PluginCollectionName is the collection name that we store plugins in mongo.
	PluginCollectionName string = "_Plugin"
	// TypefaceCollectionName is the collection name that we store typefaces in mongo.
	TypefaceCollectionName string = "_Typeface"
	// HistorySuffix is the suffix we add to a scene collection to store history data.
	HistorySuffix string = "_history"
	// VersionField is the field we add to scene history records, and it is the scene version number.
	VersionField string = "_version"
	// CgsProject
	CgsProjectCollectionName string = "_CgsProject"
	// CgsPortalCategoryCollectionName 保存cgs门户分类的集合名称
	CgsPortalCategoryCollectionName string = "_CgsPortalCategory"
	// CgsPortalVisualCollectionName 保存cgs门户视图的集合名称
	CgsPortalVisualCollectionName string = "_CgsPortal"
	// CgsPortalMapCollectionName cgs 大屏的地图
	CgsPortalMapCollectionName string = "_CgsPortalMap"
	// CgsPortalMapCollectionName cgs 大屏的数据源
	CgsPortalDbCollectionName string = "_CgsPortalDb"
	// CgsMapCollectionName cgs 大屏的数据源
	CgsMapCollectionName string = "_CgsMapScene"
	// CgsMapDataCollectionName map场景的数据
	CgsMapDataCollectionName string = "_CgsMapData"
	// CgsFileCollectionName 保存cgs文件
	CgsFileCollectionName string = "_CgsFile"
	// CgsWorksheetInfoCollectionName	表格信息
	CgsWorksheetInfoCollectionName   string = "_WorksheetInfo"
	CgsMDWorksheetInfoCollectionName string = "_MDWorksheetInfo"
	CgsTokenCollectionName           string = "_Token"
	CgsAppKeyCollectionName          string = "_AppKey"
	// Tenant 租户
	Tenant string = "_Tenant"
	// 租户信息
	TenantInfo string = "_TenantInfo"
	// License
	LicenseCollectionName string = "License"
	// Earth
	EarthCollectionName string = "_EarthScene"
	// Sms 短信验证码
	SmsValidationCode string = "_SmsValidationCode"
	// BimCollectionName bimface 场景数据库
	BimCollectionName string = "_BimScene"
	// BimModelCollectionName bim 模型
	BimModelCollectionName string = "_BimModel"
	// WorkflowCollectionName 工作流
	WorkflowCollectionName string = "_Workflow"

	// WorksheetInfoCollectionName 表单信息
	WorksheetInfoCollectionName = "WorksheetInfo"
	// WorksheetPublicCollectionName 表单信息
	WorksheetPublicCollectionName = "WorksheetPublic"
	// WorksheetPublicExtCollectionName 表单信息
	WorksheetPublicExtCollectionName = "WorksheetPublicExt"
	// WorksheetGroupCollectionName 表单分组
	WorksheetGroupCollectionName = "WorksheetGroup"
	// WorksheetShortCutCollectionName WorkSheetShortCut
	WorksheetShortCutCollectionName = "WorksheetShortCut"
	// WorksheetViewCollectionName 表单视图
	WorksheetViewCollectionName = "WorksheetView"
	// WorksheetPrintCollectionName 表单打印模板
	WorksheetPrintCollectionName = "WorksheetPrint"
	// MarketCollectionName 市场
	MarketCollectionName = "Market"
	// AutomationCollectionName 流程
	AutomationCollectionName = "Automation"

	NoticeCollectionName         = "Notice"
	NoticeRelationCollectionName = "NoticeRelation"
)

// GetAllAuthorities returns all authority ids and names.
func GetAllAuthorities() []AuthorityModel {
	result := []AuthorityModel{}
	for _, auth := range authorityMaps2 {
		result = append(result, AuthorityModel{
			ID:   string(auth.id),
			Name: auth.name,
		})
	}
	return result
}

func GetAllAuthorities2() map[string]*model.ApiAuthority {
	return apiAuthorities2
}

// AuthorityModel is authority model that store authority id and name.
type AuthorityModel struct {
	// ID is authority ID.
	ID string
	// Name is authority name.
	Name string
}

var authorityMaps = []authorityMap{
	{Administrator, "Administrator"},
	{ListAnimation, "List Animation"},
	{AddAnimation, "Add Animation"},
	{EditAnimation, "Edit Animation"},
	{DeleteAnimation, "Delete Animation"},
	{ListAudio, "List Audio"},
	{AddAudio, "Add Audio"},
	{EditAudio, "Edit Audio"},
	{DeleteAudio, "Delete Audio"},
	{SaveCategory, "Save Category"},
	{DeleteCategory, "Delete Category"},
	{ListCharacter, "List Character"},
	{EditCharacter, "Edit Character"},
	{SaveCharacter, "Save Character"},
	{DeleteCharacter, "Delete Character"},
	{ListTexture, "List Map"},
	{AddTexture, "Add Map"},
	{EditTexture, "Edit Map"},
	{DeleteTexture, "Delete Map"},
	{ListMaterial, "List Material"},
	{EditMaterial, "Edit Material"},
	{SaveMaterial, "Save Material"},
	{DeleteMaterial, "Delete Material"},
	{ListMesh, "List Mesh"},
	{AddMesh, "Add Mesh"},
	{EditMesh, "Edit Mesh"},
	{DeleteMesh, "Delete Mesh"},
	{ListParticle, "List Particle"},
	{EditParticle, "Edit Particle"},
	{SaveParticle, "Save Particle"},
	{DeleteParticle, "Delete Particle"},
	{ListPrefab, "List Prefab"},
	{EditPrefab, "Edit Prefab"},
	{SavePrefab, "Save Prefab"},
	{DeletePrefab, "Delete Prefab"},
	{EditScene, "Edit Scene"},
	{SaveScene, "Save Scene"},
	{PublishScene, "Publish Scene"},
	{DeleteScene, "Delete Scene"},
	{ListScreenshot, "List Screenshot"},
	{AddScreenshot, "Add Screenshot"},
	{EditScreenshot, "Edit Screenshot"},
	{DeleteScreenshot, "Delete Screenshot"},
	{ListVideo, "List Video"},
	{AddVideo, "Add Video"},
	{EditVideo, "Edit Video"},
	{DeleteVideo, "Delete Video"},

	{AddPortalCategory, "Add Portal Category"},
	{DeletePortalCategory, "Delete Portal Category"},
	{EditPortalCategory, "Edit Portal Category"},
	{ListPortalCategory, "List Portal Category"},

	{AddPortalVisual, "Add Portal Visual"},
	{DeletePortalVisual, "Delete Portal Visual"},
	{EditPortalVisual, "Edit Portal Visual"},
	{ListPortalVisual, "List Portal Visual"},

	{AddWorksheet, "Add Worksheet"},
	{DeleteWorksheet, "Delete Worksheet"},
	{EditWorksheet, "Edit Worksheet"},
	{ListWorksheet, "List Worksheet"},

	{AddWorksheetRecord, "Add Worksheet Record"},
	{DeleteWorksheetRecord, "Delete Worksheet Record"},
	{EditWorksheetRecord, "Edit Worksheet Record"},
	{ListWorksheetRecord, "List Worksheet Record"},
	{ImportExcel, "Import Excel"},

	{ConfigProject, "Config Project"},
	{EditCode, "Edit Code"},
}

var authorityMaps2 = []authorityMap{
	{ManageBackend, "后台管理"},
	{ConfigCategory, "分类管理"},
	//{AppAdministrator, "App Administrator"},
	{AddApp, "添加应用"},
	//{Export, "导出应用"},
	{Import, "导入应用"},
}

// authorityMap maps authority id to name.
type authorityMap struct {
	id   Authority
	name string
}

// Authority means the authority to query web api.
type Authority = string

const (
	// None means the api required no authority.
	None Authority = "NONE"
	// Initialize means that can initialize the system. Everyone has Initialize
	// authority when the system is not initialized.
	Initialize Authority = "INITIALIZE"
	// SuperAdministrator 超级管理员，普通租户没有这个权限
	SuperAdministrator Authority = "SUPER_ADMINISTRATOR"
	// Administrator means the user has all the authorities but Initialize.
	Administrator Authority = "ADMINISTRATOR"
	// AppAdministrator 应用管理员
	AppAdministrator Authority = "APP_ADMINISTRATOR"
	// AddApp 添加应用
	AddApp Authority = "ADD_APP"
	// Export 导出
	Export Authority = "EXPORT"
	// Import 导入
	Import Authority = "IMPORT"
	// ConfigCategory 分类管理
	ConfigCategory Authority = "CONFIG_CATEGORY"
	// Login means the user who has to log in.
	Login Authority = "LOGIN"
	// ListAnimation means the user can get the animation list.
	ListAnimation Authority = "LIST_ANIMATION"
	// AddAnimation means the user can upload animation.
	AddAnimation Authority = "ADD_ANIMATION"
	// EditAnimation means the user can edit the animation name and thumbnail who uploaded.
	EditAnimation Authority = "EDIT_ANIMATION"
	// DeleteAnimation means the user can delete the animation who uploaded.
	DeleteAnimation Authority = "DELETE_ANIMATION"
	// ListAudio means the user can get the audio list.
	ListAudio Authority = "LIST_AUDIO"
	// AddAudio means the user can upload audio.
	AddAudio Authority = "ADD_AUDIO"
	// EditAudio means the user can edit audio name and thumbnail who uploaded.
	EditAudio Authority = "EDIT_AUDIO"
	// DeleteAudio means the user can delete audio who uploaded.
	DeleteAudio Authority = "DELETE_AUDIO"
	// SaveCategory means the user can add new category.
	SaveCategory Authority = "SAVE_CATEGORY"
	// DeleteCategory means the user can delete the category who created.
	DeleteCategory Authority = "DELETE_CATEGORY"
	// ListCharacter means the user can get the character list.
	ListCharacter Authority = "LIST_CHARACTER"
	// EditCharacter means the user can edit character name and thumbnail who uploaded.
	EditCharacter Authority = "EDIT_CHARACTER"
	// SaveCharacter means the user can save new character who created.
	SaveCharacter Authority = "SAVE_CHARACTER"
	// DeleteCharacter means the user can delete character who created.
	DeleteCharacter Authority = "DELETE_CHARACTER"
	// ListTexture means the user can get the texture list.
	ListTexture Authority = "LIST_MAP"
	// AddTexture means the user can add new texture.
	AddTexture Authority = "ADD_MAP"
	// EditTexture means the user can edit texture name and thumbnail who uploaded.
	EditTexture Authority = "EDIT_MAP"
	// DeleteTexture means the user can delete the texture who uploaded.
	DeleteTexture Authority = "DELETE_MAP"
	// ListMaterial means the user can get the material list.
	ListMaterial Authority = "LIST_MATERIAL"
	// EditMaterial means the user can edit material name and thumbnail who saved.
	EditMaterial Authority = "EDIT_MATERIAL"
	// SaveMaterial means the user can save a new material.
	SaveMaterial Authority = "SAVE_MATERIAL"
	// DeleteMaterial means the user can delete the material who saved.
	DeleteMaterial Authority = "DELETE_MATERIAL"
	// ListMesh means the user can get the mesh list.
	ListMesh Authority = "LIST_MESH"
	// AddMesh means the user can upload new mesh.
	AddMesh Authority = "ADD_MESH"
	// EditMesh means the user can edit mesh name and thumbnail who uploaded.
	EditMesh Authority = "EDIT_MESH"
	// DeleteMesh means the user can delete mesh who uploaded.
	DeleteMesh Authority = "DELETE_MESH"
	// ListParticle means the user can get the particle list.
	ListParticle Authority = "LIST_PARTICLE"
	// EditParticle means the user can edit particle name and thumbnail who saved.
	EditParticle Authority = "EDIT_PARTICLE"
	// SaveParticle means the user can save new particle.
	SaveParticle Authority = "SAVE_PARTICLE"
	// DeleteParticle means the user can delete particle who saved.
	DeleteParticle Authority = "DELETE_PARTICLE"
	// ListPrefab means the user can get prefab list.
	ListPrefab Authority = "LIST_PREFAB"
	// EditPrefab means the user can edit prefab name and thumbnail.
	EditPrefab Authority = "EDIT_PREFAB"
	// SavePrefab means the user can save new prefab.
	SavePrefab Authority = "SAVE_PREFAB"
	// DeletePrefab means the user can delete prefab.
	DeletePrefab Authority = "DELETE_PREFAB"
	// EditScene means the user can edit scene name and thumbnail who saved.
	EditScene Authority = "EDIT_SCENE"
	// SaveScene means the user can save new scene.
	SaveScene Authority = "SAVE_SCENE"
	// PublishScene means the user can publish new scene to static content.
	PublishScene Authority = "PUBLISH_SCENE"
	// DeleteScene means the user can delete scenes who saved.
	DeleteScene Authority = "DELETE_SCENE"
	// ListScreenshot means the user can get the screenshot list.
	ListScreenshot Authority = "LIST_SCREENSHOT"
	// AddScreenshot means the user can save new screenshot.
	AddScreenshot Authority = "ADD_SCREENSHOT"
	// EditScreenshot means the user can edit screenshot name and thumbnail who saved.
	EditScreenshot Authority = "EDIT_SCREENSHOT"
	// DeleteScreenshot means the user can delete screenshot who saved.
	DeleteScreenshot Authority = "DELETE_SCREENSHOT"
	// ListVideo means the user can get the video list who saved.
	ListVideo Authority = "LIST_VIDEO"
	// AddVideo means the user can record new video and upload.
	AddVideo Authority = "ADD_VIDEO"
	// EditVideo means the user can edit video name and thumbnail who saved.
	EditVideo Authority = "EDIT_VIDEO"
	// DeleteVideo means the user can delete video who uploaded.
	DeleteVideo Authority = "DELETE_VIDEO"

	/*---------------------------Portal-------------------------------*/
	// AddPortalCategory 添加视图（大屏）分类
	AddPortalCategory Authority = "ADD_PORTAL_CATEGORY"
	// DeletePortalCategory 删除视图（大屏）分类
	DeletePortalCategory Authority = "DELETE_PORTAL_CATEGORY"
	// EditPortalCategory 修改视图（大屏）分类
	EditPortalCategory Authority = "EDIT_PORTAL_CATEGORY"
	// ListPortalCategory 获取视图（大屏）分类
	ListPortalCategory Authority = "LIST_PORTAL_CATEGORY"

	// AddPortalCategory 添加视图
	AddPortalVisual Authority = "ADD_PORTAL_VISUAL"
	// DeletePortalCategory 删除视图
	DeletePortalVisual Authority = "DELETE_PORTAL_VISUAL"
	// EditPortalCategory 修改视图
	EditPortalVisual Authority = "EDIT_PORTAL_VISUAL"
	// ListPortalCategory 获取视图
	ListPortalVisual Authority = "LIST_PORTAL_VISUAL"
	// CopyPortalVisual	复制视图
	CopyPortalVisual Authority = "COPY_PORTAL_VISUAL"
	// UploadPortalFile	上传文件（阿里oss）
	UploadPortalFile Authority = "UPLOAD_PORTAL_FILE"
	// PreviewPortalVisual 预览视图
	PreviewPortalVisual Authority = "PREVIEW_PORTAL_VISUAL"

	/*---------------------------Portal (End)------------------------------*/

	/*---------------------------Form Design-------------------------------*/
	// AddWorksheet 添加表单
	AddWorksheet Authority = "ADD_WORKSHEET"
	// DeleteWorksheet 删除表单
	DeleteWorksheet Authority = "DELETE_WORKSHEET"
	// EditWorksheet 修改表单
	EditWorksheet Authority = "EDIT_WORKSHEET"
	// ListWorksheet 获取表单
	ListWorksheet Authority = "LIST_WORKSHEET"

	// AddWorksheet 添加表单记录
	AddWorksheetRecord Authority = "ADD_WORKSHEET_RECORD"
	// DeleteWorksheet 删除表单记录
	DeleteWorksheetRecord Authority = "DELETE_WORKSHEET_RECORD"
	// EditWorksheet 修改表单记录
	EditWorksheetRecord Authority = "EDIT_WORKSHEET_RECORD"
	// ListWorksheet 获取表单记录
	ListWorksheetRecord Authority = "LIST_WORKSHEET_RECORD"
	// ImportExcel	导入excel数据
	ImportExcel Authority = "IMPORT_EXCEL"

	/*---------------------------Config Project-------------------------------*/
	ConfigProject Authority = "CONFIG_PROJECT"
	EditCode      Authority = "EDIT_CODE"
)

const (
	// CategoryCollectionName is the collection name that we store categories in mongo.
	ExportCgsFile    string = "studio/"
	ExportFormFile   string = "form/"
	ExportEditorFile string = "editor/"
	ExportPortalFile string = "portal/"
)

// 应用权限
const (
	Form    string = "FORM"
	Portal  string = "PORTAL"
	Editor  string = "EDITOR"
	Studio  string = "STUDIO"
	Builder string = "BUILDER"
)

var appAuthMap = map[Authority]*model.AppAuthority{
	EditScene:      model.NewAppAuthority(string(EditScene), "编辑场景", "", Editor),
	EditForm:       model.NewAppAuthority(string(EditForm), "可以查看、管理所有记录", "", Form),
	EditForm2:      model.NewAppAuthority(string(EditForm2), "可查看所有记录，但是只能管理自己拥有的记录", "", Form),
	EditForm3:      model.NewAppAuthority(string(EditForm3), "只能查看自己加入的和管理自己拥有的记录", "", Form),
	EditForm4:      model.NewAppAuthority(string(EditForm4), "对所有记录只有查看权限", "", Form),
	EditScript:     model.NewAppAuthority(string(EditScript), "编辑脚本", "", Studio),
	ConfigProject:  model.NewAppAuthority(string(ConfigProject), "配置工程", "", Builder),
	ConfigSnapshot: model.NewAppAuthority(string(ConfigSnapshot), "配置快照", "", Builder),
	AddComponent:   model.NewAppAuthority(string(AddComponent), "添加组件", "", Builder),
	// todo 6个类型的组件

	DeletePortalVisual:  model.NewAppAuthority(string(DeletePortalVisual), "删除应用", "", Portal),
	EditPortalVisual:    model.NewAppAuthority(string(EditPortalVisual), "编辑应用", "", Portal),
	PreviewPortalVisual: model.NewAppAuthority(string(PreviewPortalVisual), "预览应用", "", Portal),
	Export:              model.NewAppAuthority(string(Export), "导出应用", "", Portal),
}

var appAuthArray = []*model.AppAuthority{
	model.NewAppAuthority(string(EditScene), "编辑场景", "", Editor),

	model.NewAppAuthority(string(EditForm), "可以查看、管理所有记录", "DistributeAll", Form),
	model.NewAppAuthority(string(EditForm2), "可查看所有记录，但是只能管理自己拥有的记录", "DistributeAll", Form),
	model.NewAppAuthority(string(EditForm3), "只能查看自己加入的和管理自己拥有的记录", "DistributeAll", Form),
	model.NewAppAuthority(string(EditForm4), "对所有记录只有查看权限", "DistributeAll", Form),

	model.NewAppAuthority(string(EditScript), "编辑脚本", "", Studio),

	model.NewAppAuthority(string(ConfigSnapshot), "配置快照", "", Builder),
	model.NewAppAuthority(string(ConfigProject), "配置工程", "", Builder),
	model.NewAppAuthority(string(AddComponent), "添加组件", "", Builder),

	model.NewAppAuthority(string(Export), "导出应用", "", Portal),
	model.NewAppAuthority(string(DeletePortalVisual), "删除应用", "", Portal),
	model.NewAppAuthority(string(EditPortalVisual), "编辑应用", "", Portal),
	model.NewAppAuthority(string(PreviewPortalVisual), "预览应用", "", Portal),
}

var formAuthArray = []*model.AppAuthority{
	model.NewAppAuthority(FormRead, "查看表单", "DistributeSpecial", Form),
	model.NewAppAuthority(FormAdd, "添加表单", "DistributeSpecial", Form),
	model.NewAppAuthority(FormEdit, "编辑表单", "DistributeSpecial", Form),
	model.NewAppAuthority(FormDelete, "删除表单", "DistributeSpecial", Form),
	model.NewAppAuthority(RowAdd, "添加记录", "DistributeSpecial", Form),
	model.NewAppAuthority(RowReadOwn, "可查看自己加入的记录", "DistributeSpecial", Form),
	model.NewAppAuthority(RowReadAll, "可查看所有的记录", "DistributeSpecial", Form),
	model.NewAppAuthority(RowEditOwn, "可编辑自己加入的记录", "DistributeSpecial", Form),
	model.NewAppAuthority(RowEditAll, "可编辑所有的记录", "DistributeSpecial", Form),
	model.NewAppAuthority(RowDeleteOwn, "可删除自己加入的记录", "DistributeSpecial", Form),
	model.NewAppAuthority(RowDeleteAll, "可删除所有的记录", "DistributeSpecial", Form),
}

func GetAllAppAuth() []*model.AppAuthority {
	//var arr []*model.AppAuthority
	//for k := range appAuthMap {
	//	arr = append(arr, appAuthMap[k])
	//}
	return appAuthArray
}

func GetAppFormAuth() (auths []*model.AppAuthority) {
	auths = append(auths, appAuthArray...)
	auths = append(auths, formAuthArray...)
	return
}

const (
	// EditScene 1. 编辑场景

	//EditForm 2. 编辑表单
	// 可以查看、管理所有记录
	EditForm Authority = "EDIT_FORM"
	// EditForm2 可查看所有记录，但是只能管理自己拥有的记录
	EditForm2 Authority = "EDIT_FORM2"
	// EditForm3 只能查看自己加入的管理自己拥有的记录
	EditForm3 Authority = "EDIT_FORM3"
	// EditForm4 对所有记录只有查看权限
	EditForm4 Authority = "EDIT_FORM4"

	FormRead     = "FORM_READ"
	FormEdit     = "FORM_EDIT"
	FormDelete   = "FORM_DELETE"
	FormAdd      = "FORM_ADD"
	RowAdd       = "ROW_ADD"
	RowReadAll   = "ROW_READ_ALL"
	RowReadOwn   = "ROW_READ_OWN"
	RowEditAll   = "ROW_EDIT_ALL"
	RowEditOwn   = "ROW_EDIT_OWN"
	RowDeleteAll = "ROW_DELETE_ALL"
	RowDeleteOwn = "ROW_DELETE_OWN"

	//EditScript 3. 编辑脚本
	EditScript Authority = "EDIT_SCRIPT"
	//ConfigProject 4. 配置工程

	//ConfigSnapshot 5. 配置快照
	ConfigSnapshot Authority = "CONFIG_SNAPSHOT"
	//AddComponent 6. 添加组件
	AddComponent Authority = "ADD_COMPONENT"
	// ManageAppAuth 6.1
	// 应用权限管理
	ManageAppAuth Authority = "MANAGE_APP_AUTH"
)

// 内置角色
// 管理员
// 应用管理员
// 普通用户

// 内置角色的权限
//  后台管理
const (
	ManageBackend Authority = "MANAGE_BACKEND"
	ManageLicence Authority = "MANAGE_LICENCE"
)

//  添加应用
// 导入
// 导出
// 分类管理
